import request from '@/utils/request'

export function get_userlist(params) {
  return request({
    url: '/fl-admin/getAllNormalUserDetail',

    method: 'get',
    params

  })
}

//获取菜单 
export function getAuthMenu() {
  return request({
       // url: '/fl-menu/getMenuList',   旧获取菜单接口
       url: '/fl-menu/getMenuList2',
    method: 'get',
    
  })
}

//编辑菜单
export function editMenu(data) {
  return request({
    url: '/fl-menu/editMenuItem',
    method: 'put',
    data
  })
}

//添加菜单
export function addMenu(data) {
  return request({
    url: '/fl-menu/addMenuItem',
    method: 'put',
    data
  })
}

//删除菜单
export function deleteMenu(data) {
  return request({
    url: '/fl-menu/deleteMenuItem?id='+data,
    method: 'delete',
  
  })
}

//获取管理员列表
export function getAdminList(params) {
  return request({
    url: '/fl-admin/getAllAdminDetail',
    method: 'get',
    params
  })
}

//封禁管理员用户
export function banAdmin(params) {
  return request({
    url: '/fl-admin/changeUserStatus',
    method: 'post',
    params
  })
}

//删除管理员用户
export function deleteAdmin(params) {
  return request({
    url: '/fl-admin/deleteBatchAdminOrUser',
    method: 'DELETE',
    params
  })
}

//判断用户是否存在
export function checkUser(params) {
  return request({
    url: '/fl-searchUser/existUserByUsername',
    method: 'get',
    params
  })
}

//添加管理员用户
export function addAdmin(params) {
  return request({
    url: '/fl-admin/createAdmin',
    method: 'put',
    params
  })
}

//获取用户近期登录记录
export function getUserLoginRecord(params) {
  return request({
    url: '/fl-admin/getUserLoginDetailByUserId',
    method: 'get',
    params
  })
}

//获取角色列表
export function getRoleList(params) {
  return request({
    url: '/fl-admin/getRolesList',
    method: 'get',
    params
  })
}

//分配菜单
export function assignMenu(params) {
  return request({
    url: '/fl-menu/allocateResources',
    method: 'post',
    params
  })
}

//编辑角色
export function editRole(params) {
  return request({
    url: '/fl-admin/changeAdminDetail',
    method: 'post',
    params
  })
}

//查询角色菜单
export function getRoleMenu(data) {
  return request({
    url: '/fl-admin/searchRoleMenu',
    method: 'post',
    data
  })
}

//角色分配
export function assignRole(data) {
  return request({
    url: '/fl-admin/roleAssignment',
    method: 'post',
    data
  })
}